<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // let aa = 10;
        // console.log(typeof aa);
        // aa = "10";
        // console.log(typeof aa);
        // aa = true;
        // console.log(typeof aa);
        // let bb;
        // console.log(typeof bb);

        //  let aa = 10;
        // let bb = "10";
        // console.log("aa==bb : "+ (aa==bb));
        // console.log("aa===bb : "+ (aa===bb));

        let array = [];
        let array2 = [10,"10",true];
        //取值
        console.log(array2[0]);
        console.log(array2[1]);
        console.log(array2[2]);
        //添加
        array[3] = 'b';
        console.log(array[3]);
        console.log(array.length);

        //删除
        // array2.splice(0,2);//第一个参数为删除的起始下标，第二个参数是删除个数
        // console.log(array2);
        array2["aaa"] = 97;//非数字下标可以加进数组，但是不会增加length长度
        console.log(array2);
        console.log(array2.length);
        array2[100] = 1;
        console.log(array2);
        console.log(array2.length);

        //函数定义
        
        // sum(10,true);//true会当作1，所以结果是11，false会被当做0
        // function sum(x,y){
        //     console.log(x+y);
        // }
        //匿名函数表达式
        // let sum = function(x,y){
        //     console.log(x+y);
        // }
        // sum(10,20);
        // sum(30,90);

        //对象定义
        let student = {};
        let teacher = {
            name:"张三",
            age:10,
            celeNumber:178276009
        }
        //读
        console.log(teacher.name);
        console.log(teacher["name"]);
        console.log(teacher);
        //修改
        teacher.age = 18;
        teacher.name = '李四';
        console.log(teacher);
        //添加
        student.name = "空对象赋值";
        console.log(student);
    </script>
</body>
</html>